#!/bin/sh
# 脚本所在目录
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
isCloud=$1

#cd -P $SHELL_FOLDER/src/sportsWebApi/sportsWebApi
#pwd
tf=netcoreapp3.1
arch=linux-x64
#arch=win-x64
#arch=osx-x64
#if "$1"! <> "" tf=$1
#publishDir=../../../bin/$arch_$tf
publishDir=$SHELL_FOLDER/bin/${arch}_$tf
#echo $publishDir
dotnet publish $SHELL_FOLDER/iot/zlw.iot/zlw.iot.csproj -v q --nologo -c Release -f $tf -r $arch --output $publishDir
if [  "$isCloud" == "1"  ];then
dotnet publish $SHELL_FOLDER/iot/services/RestfullApi.ZlwAuth/RestfullApi.ZlwAuth.csproj -v q --nologo -c Release -f $tf -r $arch --output $publishDir
cp $SHELL_FOLDER/../zlw-cloudWeb/doc/data_cloud.db $publishDir/data.db
else
cp $SHELL_FOLDER/../zlw-cloudWeb/doc/data.db $publishDir/data.db
fi

find $publishDir -name "*.pdb" |xargs rm -rf